package com.zhuss.util;

import java.util.ArrayList;
import java.util.List;

import com.zhuss.bean.unit.food.FoodTime;
import com.zhuss.bean.vo.food.product.week.wechat.FloorVo;
import com.zhuss.common.EnumVo;
import com.zhuss.common.SelectVo;
import com.zhuss.enums.Area;
import com.zhuss.enums.EnumUtil;

public class FloorUtil {
	
	public static List<FloorVo> floorListOld() {
		List<FloorVo> result = new ArrayList<FloorVo>();
		List<SelectVo> selectVoList = EnumUtil.listSelect(com.zhuss.enums.FoodTime.class);
		List<FoodTime> foodTimeList = new ArrayList<FoodTime>();
		for (SelectVo sv : selectVoList) {
			FoodTime ft = new FoodTime();
			ft.setFoodTimeId(sv.getId());
			ft.setFoodTimeName(sv.getName());
			foodTimeList.add(ft);
		}
		selectVoList = EnumUtil.listSelect(com.zhuss.enums.Floor.class);
		for (SelectVo sv : selectVoList) {
			FloorVo st = new FloorVo();
			st.setFloorId(sv.getId());
			st.setFloorName(sv.getName());
			st.setFoodTimeList(foodTimeList);
			result.add(st);
		}
		return result;
	}
	
	public static List<FloorVo> floorList() {
		List<FloorVo> result = new ArrayList<FloorVo>();
		List<EnumVo> foodFloorListBasic = EnumUtil.listSelectEnum(com.zhuss.enums.Floor.class);
		List<SelectVo> foodTimeListBasic = EnumUtil.listSelect(com.zhuss.enums.FoodTime.class);
		for (EnumVo ev : foodFloorListBasic) {
			List<FoodTime> foodTimeList = new ArrayList<FoodTime>();
			FloorVo st = new FloorVo();
			st.setFloorId(ev.getId());
			st.setFloorName(ev.getName());
			for (SelectVo sv2 : foodTimeListBasic) {
				if (!ev.getRemoveIdList().contains(sv2.getId())) {
					FoodTime ft = new FoodTime();
					ft.setFoodTimeId(sv2.getId());
					ft.setFoodTimeName(sv2.getName());
					foodTimeList.add(ft);
				}
			}
			st.setFoodTimeList(foodTimeList);
			result.add(st);
		}
		return result;
	}
	
	
	public static List<FloorVo> floorList(Integer area) {
		List<FloorVo> result = new ArrayList<FloorVo>();
		List<EnumVo> foodFloorListBasic = null;
		if (Area.西区.sameKey(area)) {
			foodFloorListBasic = EnumUtil.listSelectEnum(com.zhuss.enums.Floor.class);
		} else {
			foodFloorListBasic = EnumUtil.listSelectEnum(com.zhuss.enums.Floor2.class);
		}
		List<SelectVo> foodTimeListBasic = EnumUtil.listSelect(com.zhuss.enums.FoodTime.class);
		for (EnumVo ev : foodFloorListBasic) {
			List<FoodTime> foodTimeList = new ArrayList<FoodTime>();
			FloorVo st = new FloorVo();
			st.setFloorId(ev.getId());
			st.setFloorName(ev.getName());
			for (SelectVo sv2 : foodTimeListBasic) {
				if (!ev.getRemoveIdList().contains(sv2.getId())) {
					FoodTime ft = new FoodTime();
					ft.setFoodTimeId(sv2.getId());
					ft.setFoodTimeName(sv2.getName());
					foodTimeList.add(ft);
				}
			}
			st.setFoodTimeList(foodTimeList);
			result.add(st);
		}
		return result;
	}
	

}
